package com.ruoyi.web.controller.scrap;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.scrap.domain.ScrapApplyOut;
import com.ruoyi.scrap.service.ScrapApplyOutService;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/scrap/out")
public class ScrapApplyOutController extends BaseController {

    @Resource
    ScrapApplyOutService outService;

    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return AjaxResult.success(outService.getById(id));
    }

    @PostMapping
    public AjaxResult add(@RequestBody ScrapApplyOut out) {
        return toAjax(outService.save(out,getLoginUser().getUser()));
    }

    @DeleteMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        outService.remove(ids,getLoginUser().getUser());
        return AjaxResult.success();
    }

}
